<?php

/**
 * @author @author Samrat Khan & Sadik Sarfaraz - May 19, 2013
 */
require 'top.inc.php';
$formLoad = new Form();
if(isset($_SESSION['user']) && $_SESSION['user']['utype'] == 1 || $_SESSION['user']['utype'] == 2 || $_SESSION['user']['utype'] == 3 || $_SESSION['user']['utype'] == 4) {
    $sess_cusID = $_SESSION['user']['cus_id'];
?>
<form name="addStockIn" id="addStockIn" method="post">
<?php
echo "<table class=\"form-inline row-fluid table table-striped table-bordered\">";
    echo "<tr>";
    
        echo "<th>" . $stock_in['serialno'] . "</th>";
        echo "<th>" . $stock_in['project_id'] . "</th>";
        echo "<th>" . $stock_in['productid'] . "</th>";
        echo "<th>" . $stock_in['description'] . "</th>";
        echo "<th>" . $stock_in['revisionstate'] . "</th>";
        echo "<th>" . $stock_in['shiptype'] . "</th>";
        echo "<th>" . $stock_in['in_quantity'] . "</th>";
        echo "<th>" . $stock_in['uom'] . "</th>";        
        echo "<th>" . $stock_in['invoicenumber'] . "</th>";
        echo "<th>" . $stock_in['shipid'] . "</th>";
        echo "<th>" . $stock_in['mawb'] . "</th>";
        echo "<th>" . $stock_in['hawb'] . "</th>";
        echo "<th>" . $stock_in['receiveddate'] . "</th>";
        echo "<th>" . $stock_in['shipfrom'] . "</th>";
        echo "<th>" . $stock_in['boxno'] . "</th>";
        echo "<th>" . $stock_in['rma'] . "</th>";
        echo "<th>" . $stock_in['warehouse_name'] . "</th>";
        echo "<th>" . $stock_in['rackno'] . "</th>";
        echo "<th>" . $stock_in['docketnumber'] . "</th>";
        echo "<th>" . $stock_in['manufacturingdate'] . "</th>";
        echo "<th>" . $stock_in['pickuprequestdate'] . "</th>";
        echo "<th>" . $stock_in['employee_id'] . "</th>";
        echo "<th>" . $stock_in['eng_id'] . "</th>";
        echo "<th>" . $stock_in['siteid'] . "</th>";
        echo "<th>" . $stock_in['docketdate'] . "</th>";
        echo "<th>" . $stock_in['remarks'] . "</th>";
        echo "<th>" . "&nbsp;" . "</th>";
    echo "</tr>";
    
    echo "<tr>";
        echo "<td>" . $formLoad->textField('serialno', "", "", $stock_in['serialno']) . "</td>";
        echo "<td>";
            echo "<select name='project_id'>";
                echo getProjects(cus_id, $sess_cusID, $db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField('productid', "", "productid", $stock_in['productid']) . "</td>";
        echo "<td>" . $formLoad->textArea("description", "", "") . "</td>";
        echo "<td>" . $formLoad->textField('revisionstate', "", "", $stock_in['revisionstate']) . "</td>";
        echo "<td>";
            echo "<select id='shiptype' name='shiptype'>";
                echo getShipTypes($db);
            echo "</select>";
        echo "</td>";
        echo "<td>". $formLoad->textField('in_quantity', "", "", $stock_in['in_quantity']) ."</td>";
        echo "<td>";
            echo "<select name='uom'>";
                echo getUOM($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField('invoicenumber', "", "", $stock_in['invoicenumber']) . "</td>";
        echo "<td>" . $formLoad->textField('shipid', "", "", $stock_in['shipid']) . "</td>";
        echo "<td>" . $formLoad->textField('mawb', "", "", $stock_in['mawb']) . "</td>";
        echo "<td>" . $formLoad->textField('hawb', "", "", $stock_in['hawb']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate('receiveddate', "input-append date", "receiveddate", $stock_in['receiveddate']) . "</td>";
        echo "<td>" . $formLoad->textField('shipfrom', "", "", $stock_in['shipfrom']) . "</td>";
        echo "<td>" . $formLoad->textField('boxno', "", "", $stock_in['boxno']) . "</td>";
        echo "<td>" . $formLoad->textField('rma', "", "", $stock_in['rma']) . "</td>";
        echo "<td>";
            echo "<select name=\"warehouse_id\">";
                echo getWarehousesCode($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField('rackno', "", "", $stock_in['rackno']) . "</td>";
        echo "<td>" . $formLoad->textField('docketnumber', "", "", $stock_in['docketnumber']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate("manufacturingdate", "input-append date", "manufacturingdate", $stock_in['manufacturingdate']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate("pickuprequestdate", "input-append date", "pickuprequestdate", $stock_in['pickuprequestdate']) . "</td>";
        echo "<td>";
            echo "<select name='employee_id'>";
                echo getEmployees($db);
            echo "</select>";
        echo "</td>";
        echo "<td>";
            echo "<select name='eng_id'>";
                echo getEngineers($db);
            echo "</select>";
        echo "</td>";
        echo "<td>" . $formLoad->textField("siteid", "", "", $stock_in['siteid']) . "</td>";
        echo "<td>" . $formLoad->textFieldDate("docketdate", "input-append date", "docketdate", $stock_in['docketdate']) . "</td>";
        echo "<td>" . $formLoad->textArea("remarks", "", "") . "</td>";
        echo '<input type="hidden" name="userid" value="'.$_SESSION['user']['id'].'" />';
        echo '<input type="hidden" name="cus_id" value="'.$_SESSION['user']['cus_id'].'" />';
        echo '<input type="hidden" name="session_id" value="'.  session_id() .'" />';
        echo '<input type="hidden" name="junkentry" value="0" />';
        echo "<td>";
            echo '<input id="AddStockInBtn" class="btn btn-primary" type="submit" value="Add Item" name="addStockIn" />';
        echo "</td>";
    echo "</tr>";
echo "<table>";
?>
</form>

<div id="show"></div>
<?php
}
include 'bottom.inc.php';
?>